module FileWatcher 
	def initialize(*args)
		@client = args.first
		puts "FileWatcher: #{@client}"
	end
	def file_modified
		puts "#{path} modified"
		input = `tail -n 1 #{path}`.chomp
		execute_command input
	end

	def execute_command(input)
		return if input =~ /help|quit/
			begin
				(@client.instance_eval input)
			rescue Exception => e
				puts e
			end
	end

	def file_moved
		puts "#{path} moved"
	end

	def file_deleted
		puts "#{path} deleted"
	end

	def unbind
		puts "#{path} monitoring ceased"
	end
end

